******************************************************************************************************
******************************************************************************************************
//-----------The economic consequences of protest repression: the case of business activism in Hong Kong----------//
//-------------------------------For Replication ------------------------------------//
******************************************************************************************************
******************************************************************************************************

//---------------NOTES---------------//
*Please install the following package
ssc install interflex, replace all

//---------------PB REPLICATION DATA---------------//
**IMPORTANT: The shapefile must be in the same/current directory



use "DATA_business activism"
merge 1:1 CACODE using hk2019, keep(match) keepusing(id)
drop _merge
spmatrix create contiguity W, replace
spmatrix create idistance M, replace

global r cuisine_hk cuisine_chi plow phigh 
global demo lnpopulation age edu lnincome language_cantonese language_putonghua afford


***Table 1. Descriptive statistics***
sum ry tear xprotest dem cuisine_hk cuisine_chi plow pmedian phigh Population age edu income language_cantonese language_putonghua afford BOC if dem!=.

***Figures 1 and 2: Please use the ArcGIS Pro to open "map_restaurant.lyrx" for Figure 1 and "map_tg.lyrx" for Figure 2. ***

***Table 2. Baseline models:the effect of tear gas on the proportion of yellow restaurants***
reg ry tear ,robust
est store model1
reg ry tear dem $r $demo, robust
est store model2
reg ry tear dem $r $demo i.xx, robust
est store model3
reg ry tear xprotest dem $r $demo i.xx, robust
est store model4
outreg2 [*] using "test.xls", replace  bdec(3) sdec(3)
drop _est_m*

***Table 3. Instrumental variable estimation***
ivregress 2sls  ry  (tear = lnboc) if dem!=.,first robust
est store model1
ivregress 2sls  ry dem $r $demo (tear = lnboc) if dem!=.,first robust
est store model2
ivregress 2sls  ry xprotest dem $r  $demo i.xx (tear = lnboc) ,first robust
est store model3
outreg2 [*] using "test.xls", replace  bdec(3) sdec(3)
drop _est_m*

***heterogeneous test: Figures 3 and 4***
interflex ry tear dem xprotest $r $demo  if dem<.75 & dem>.35, vce(robust) nbins(2) fe(xx) xlabel("Pro-Democracy Vote Share") ylabel("Proportion of Yellow Restaurants")
interflex ry tear dem xprotest $r $demo  if dem<.75 & dem>.35, vce(robust) nbins(4) fe(xx) xlabel("Pro-Democracy Vote Share") ylabel("Proportion of Yellow Restaurants")

***Figure A1 histogram on yellow restaurants proportions***
histogram ry,fraction
***Table A1 excluding extreme values of dependent variable***
reg ry tear xprotest dem $r $demo i.xx, robust
est store model1
reg ry tear xprotest dem $r $demo i.xx if ry <.25, robust
est store model2
reg ry tear xprotest dem $r $demo i.xx if ry <.18, robust
est store model3
outreg2 [*] using "test.xls", replace  bdec(3) sdec(3)
drop _est_m*

***Table A2 different variable formats***
gen lnTear_frequency=ln(1+Tear_frequency)
gen Tear_density= Tear_frequency/Area
reg ry tear xprotest dem $r $demo i.xx, robust
est store model1
reg ry lnTear_frequency,robust
est store model2
reg ry lnTear_frequency xprotest dem $r $demo i.xx, robust
est store model3
reg ry Tear_density, robust
est store model4
reg ry Tear_density xprotest dem $r $demo i.xx, robust
est store model5
outreg2 [*] using "test.xls", replace  bdec(3) sdec(3)
drop _est_m*

***Table A3 alternative modelling approach***
reg ry tear xprotest dem $r $demo i.xx, robust
est store model1
tobit ry tear xprotest dem $r $demo i.xx, ll(0) ul(1) 
est store model2
logit y tear xprotest dem $r $demo i.xx
est store model3
outreg2 [*] using "test.xls", replace  bdec(3) sdec(3)
drop _est_m*

***Table A4 using 2016 demographic variables***
global demo2016 lnpopulation2016 age2016 edu2016 lnincome2016 language_cantonese2016 language_putonghua2016 afford2016
reg ry tear xprotest dem $r $demo2016, robust
est store model1
reg ry tear xprotest dem $r $demo2016 i.xx, robust
est store model2
outreg2 [*] using "test.xls", replace  bdec(3) sdec(3)
drop _est_m*

***Table A5 The Effects of Confrontations and Protest Repressions***
reg ry xprotest  dem $r $demo i.xx, robust
est store model1
reg ry lnprotest dem $r $demo i.xx, robust
est store model2
reg ry protest_density dem $r $demo i.xx, robust
est store model3
reg ry tear xprotest  dem $r $demo i.xx, robust
est store model4
reg ry tear lnprotest dem $r $demo i.xx, robust
est store model5
reg ry tear protest_density dem $r $demo i.xx, robust
est store model6
outreg2 [*] using "test.xls", replace  bdec(3) sdec(3)
drop _est_m*


***Table A6 spatial regression models***
spregress ry tear if dem!=. , gs2sls dvarlag(W) errorlag(W) force
est store model1
spregress ry tear xprotest dem $r $demo , gs2sls dvarlag(W) errorlag(W) force
est store model2
spregress ry tear xprotest dem $r $demo i.xx, gs2sls dvarlag(W) errorlag(W) force
est store model3
outreg2 [*] using "test.xls", replace  bdec(3) sdec(3)
drop _est_m*

***Table A7 Balance Tests of Constituency Characteristics (with and without BOC)***
ttest dem,by(xboc)
ttest income,by(xboc)
ttest phigh,by(xboc)

***Binning Estimators across Different Model Specifications***
***figure A2***
interflex ry tear dem   if dem<.75 & dem>.35, vce(robust) nbins(2)  xlabel("Pro-Democracy Vote Share") ylabel("Proportion of Yellow Restaurants")
***figure A3***
interflex ry tear dem   if dem<.75 & dem>.35, vce(robust) nbins(4)  xlabel("Pro-Democracy Vote Share") ylabel("Proportion of Yellow Restaurants")
***figure A4***
interflex ry tear dem xprotest $r $demo  if dem<.75 & dem>.35, vce(robust) nbins(2)  xlabel("Pro-Democracy Vote Share") ylabel("Proportion of Yellow Restaurants")
***figure A5***
interflex ry tear dem xprotest $r $demo  if dem<.75 & dem>.35, vce(robust) nbins(4)  xlabel("Pro-Democracy Vote Share") ylabel("Proportion of Yellow Restaurants")

***Table A8 Tear gas and the proportion of survived yellow restaurants after three years***
reg survived tear ,robust
est store model1
reg survived tear dem $r $demo xprotest, robust
est store model2
reg survived tear xprotest dem $r $demo i.xx, robust
est store model3
outreg2 [*] using "test.xls", replace  bdec(3) sdec(3)
drop _est_m*

***Table A9 The effect of tear gas on the proportion of blue restaurants***
reg rb tear if dem!=.,robust
est store model1
reg rb tear dem $r $demo, robust
est store model2
reg rb tear dem $r $demo i.xx, robust
est store model3
reg rb tear xprotest dem $r $demo i.xx, robust
est store model4
outreg2 [*] using "test.xls", replace  bdec(3) sdec(3)
drop _est_m*
